<template>
  <el-dialog title="选择车辆" :visible.sync="dialogBoole" width="65%">
    <el-form :inline="true" :model="form" class="demo-form-inline">
      <el-form-item label="车牌号:">
        <el-input v-model="form.carNo" clearable placeholder="请输入品牌名称"></el-input>
      </el-form-item>
      <el-form-item>
        <el-button @click="resetQuery">重置</el-button>

        <el-button type="primary" @click.stop="handleQuery">查询</el-button>
      </el-form-item>

    </el-form>

    <el-table :data="tableData" border>

      <el-table-column label="操作" align="center" fixed="left" width="100">
        <template #default="{row}">
          <el-button size="mini" type="text" @click="handleSelect(row)">
            选择车辆
          </el-button>
        </template>
      </el-table-column>

      <el-table-column label="车牌号" prop="carNo" show-overflow-tooltip align="center"/>

      <el-table-column label="车架号" prop="vinNo" show-overflow-tooltip align="center"/>

      <el-table-column label="品牌/车型/车款" show-overflow-tooltip align="center">
        <template #default="{row}">
          {{ row.brandName }}/{{ row.modelName }}/{{ row.seriesName }}
        </template>
      </el-table-column>

      <el-table-column label="车辆产权" prop="propertyRightName" show-overflow-tooltip align="center"/>

      <el-table-column label="客户名称" prop="customerName" show-overflow-tooltip align="center"/>

      <el-table-column label="产品方案" prop="schemeName" show-overflow-tooltip align="center"/>

      <el-table-column label="出库时间" prop="outStorageTime" show-overflow-tooltip align="center">
        <template #default="{row}">
          {{ row.outStorageTime ? $dayjs(row.outStorageTime).format('YYYY-MM-DD') : '' }}
        </template>
      </el-table-column>

      <el-table-column label="还车时间" show-overflow-tooltip align="center">
        <template #default="{row}">
          {{ row.returnTime ? $dayjs(row.returnTime).format('YYYY-MM-DD') : '' }}
        </template>
      </el-table-column>

      <el-table-column label="财务收款时间" show-overflow-tooltip align="center">
        <template #default="{row}">
          {{ row.financialPassedTime ? $dayjs(row.financialPassedTime).format('YYYY-MM-DD') : '' }}
        </template>
      </el-table-column>

    </el-table>
  </el-dialog>
</template>

<script>
import {getVehicleDisposalList} from "@/api/vehicleDisposal/purchaseHandle.js"

export default {
  name: "carTable",
  computed: {},
  watch: {},
  data() {
    return {
      form: {
        carNo: '',
      },
      dialogBoole: false,
      tableData: [],
      carId: null
    };
  },
  created() {
  },
  mounted() {
  },
  methods: {
    handleSelect(row) {
      this.$emit('handleSelect', row || {})
      this.dialogBoole = false
    },

    handleOpen() {
      this.dialogBoole = true
      this.handleList()
    },

    resetQuery() {
      this.form = {
        carNo: '',
        isDisposal: '',
        pageSize: 10,
        pageNum: 1,
      }
      this.handleList()
    },

    handleQuery() {
      this.form.pageNum = 1
      this.handleList()
    },

    async handleList() {
      try {
        const res = await getVehicleDisposalList(this.form)
        this.tableData = res.data || []
      } catch (e) {
        console.error(e)
      }

    }
  },
};
</script>

<style scoped lang=""></style>


